package com.qfedu.suppliercontrol.service.impl;


import com.qfedu.common.entity.Suppliers;
import com.qfedu.suppliercontrol.mapper.SuppliersMapper;
import com.qfedu.suppliercontrol.service.SuppliersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 供应商表：存储所有与供应商相关的详细信息(Suppliers)表服务实现类
 *
 * @author makejava
 * @since 2025-01-16 17:29:08
 */
@Service
public class SuppliersServiceImpl implements SuppliersService {
    @Resource
    private SuppliersMapper suppliersMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param supplierId 主键
     * @return 实例对象
     */
    @Override
    public Suppliers queryById(Integer supplierId) {
        return this.suppliersMapper.queryById(supplierId);
    }

    /**
     * 分页查询
     *
     * @return 查询结果
     */
    @Override
    public List<Suppliers> list(Suppliers suppliers ) {
        List<Suppliers> list = suppliersMapper.list();
        return list;
    }

    /**
     * 新增数据
     *
     * @param suppliers 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(Suppliers suppliers) {
        return this.suppliersMapper.insert(suppliers);
    }

    /**
     * 修改数据
     *
     * @param suppliers 实例对象
     * @return 实例对象
     */
    @Override
    public int update(Suppliers suppliers) {
        return this.suppliersMapper.update(suppliers);
    }

    /**
     * 通过主键删除数据
     *
     * @param supplierId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer supplierId) {
        return this.suppliersMapper.deleteById(supplierId) > 0;
    }
}
